var protos = {
    '10002':{'fn':user_inf}
}

function get_proto_Inf(protoId) {
    var inf = protos[protoId];    
    return inf;
}

function user_inf(dv) {
    var dataV = new DataView(dv.buffer);

    var uid = dataV.getInt32(0,true); //前四个字节是uid
    console.log("----- uid",uid);
    
    // dataV.buffer.slice(4) 去掉前四个字节的数据，剩余是收到的数据
    var blob = new Blob([dataV.buffer.slice(4)],{type:'text/plain;charset=UTF-8'});
    function rece(msg) {
        console.log("rece msg:",msg);
        
    }
    retParseBlob = parseBlob(blob,rece);
    console.log("retParseBlob",retParseBlob);
    /*
    //下列代码尝试自己解析blob数据，但是解析出来的是乱码
    var offset = 4;
    var len = dataV.byteLength - offset;
    var msgStr = "";
    var code = dataV.getUint16(4,true);
    var char = String.fromCharCode(code); //20320 
    console.log("char,code",char,code);
    for (let index = 0; index < len; index++) {
        var byte = dataV.getUint8(offset);
        var char = String.fromCharCode(byte);
        offset++;
        //console.log("dataV.byteOffset,byte",dataV.byteOffset,byte,char); //你好!js,I am python!  
        msgStr+=char;      
    }        
    console.log("user_inf uid:",uid,"msgStr",msgStr,'你'.charCodeAt(0));   
    */

}


